package com.chen.qmzy.service;

import com.chen.qmzy.dao.DwProDao;
import com.chen.qmzy.entity.DwProductEntity;
import com.chen.qmzy.entity.ResultEntity;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class DwProService {
    private static final Logger logger= LoggerFactory.getLogger(DwProService.class);//日志getLogger需要传入的类名
    @Resource
    DwProDao dwProDao;

    /**
     * 获取动物商品列表
     * @return String
     */
    public String getDwProList(int start,int cnt){
        try{
            return ResultEntity.success(dwProDao.getDwProList(start,cnt));
        }catch (Exception e){
            logger.error(e.getLocalizedMessage());
            return ResultEntity.fail(-10005);
        }
    }

    /**
     * 根据id获取商品页动物详情
     * @param id
     * @return
     */
    public DwProductEntity getDwProductDetail(int id){
//        try{
//            return ResultEntity.success(dwProDao.getDwProductDetailList(Id));
//        }catch (Exception e){
//            logger.error(e.getLocalizedMessage());
//            return ResultEntity.fail(-10005);
//        }
        return dwProDao.getDwProductDetail(id);
    }

}
